
<template>
  <div>

  
    <ex-dialog
      width="1100px"
      class="ex-diolog"
      title="进件资料"
      :visible="visible"
      @closeDialog="handleClose"
    >
      <div class="moneyDetail">
        <div class="bt_box">
          <p class="btText">子商户进件状态</p>
        </div>
        <div class="information" style="display: block">
          <div class="list_box">
            <div class="list">
              <div class="lable">日常消费账户进件状态:</div>
              <div class="text">{{ entryStatusInfo.everydayEntryStatusDict }}</div>
            </div>
            <div class="list">
              <div class="lable">失败原因:</div>
              <div class="text">{{ entryStatusInfo.everydayRemark }}</div>
            </div>
          </div>
          <div class="list_box">
            <div class="list">
              <div class="lable">存管账户进件状态:</div>
              <div class="text">{{ entryStatusInfo.depositEntryStatusDict }}</div>
            </div>
            <div class="list">
              <div class="lable">失败原因:</div>
              <div class="text">{{ entryStatusInfo.depositRemark }}</div>
            </div>
          </div>
        </div>
        <div class="bt_box">
          <p class="btText">子商户进件基本资料</p>
        </div>
        <div class="information">
          <div class="list">
            <div class="lable">支付公司:</div>
            <div class="text">银盛</div>
          </div>
          <div class="list">
            <div class="lable">子商户类型:</div>
            <div class="text" v-if="!basicModifyshow">
              {{ data.merchantTypeDict }}
            </div>
            <div class="txt" v-if="basicModifyshow">
              <el-select v-model="fromBase.merchantType" placeholder="请选择">
                <el-option v-for="item in options" :key="item.id" :label="item.value" :value="item.id">
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="list">
            <div class="lable">企业名称:</div>
            <div class="text" v-if="!basicModifyshow">
              {{ data.businessLicence }}
            </div>
            <div v-if="basicModifyshow">
              <el-input v-model="fromBase.businessLicence" placeholder="请输入"></el-input>
            </div>
          </div>
          <div class="list">
            <div class="lable">统一社会信用代码:</div>
            <div class="text" v-if="!basicModifyshow">
              {{ data.businessLicenceNo }}
            </div>
            <div v-if="basicModifyshow">
              <el-input v-model="fromBase.businessLicenceNo" placeholder="请输入"></el-input>
            </div>
          </div>
          <div class="list">
            <div class="lable">企业成立日期:</div>
            <div class="text" v-if="!basicModifyshow">
              {{ data.businessLicenceSdate }}
            </div>
            <div v-if="basicModifyshow">
              <!-- <el-input
                v-model="fromBase.businessLicenceSdate"
                placeholder="请输入"
              ></el-input> -->
              <el-date-picker v-model="fromBase.businessLicenceSdate" type="date" placeholder="选择日期" format="yyyy.MM.dd"
                value-format="yyyy.MM.dd" :clearable="false">
              </el-date-picker>
            </div>
          </div>
          <div class="list">
            <div class="lable">经营期限:</div>
            <div class="text" v-if="!basicModifyshow">
              {{ data.businessLicenceEdate }}
            </div>
            <div v-if="basicModifyshow">
              <!-- <el-input
                v-model="fromBase.businessLicenceEdate"
                placeholder="请输入"
              ></el-input> -->
              <el-radio-group v-model="radio" @change="changeRadio">
                <el-radio :label="1">
                  <el-date-picker v-model="qxDate" type="date" placeholder="选择日期" :clearable="false"
                    value-format="yyyy-MM-dd" :disabled="pickDisabled" @change="changeDate">
                  </el-date-picker>
                </el-radio>
                <el-radio :label="2" style="margin-top: 10px">长期</el-radio>
              </el-radio-group>
            </div>
          </div>
          <div class="list">
            <div class="lable">法人名字:</div>
            <div class="text" v-if="!basicModifyshow">
              {{ data.legalPersonName }}
            </div>
            <div v-if="basicModifyshow">
              <el-input v-model="fromBase.legalPersonName" placeholder="请输入"></el-input>
            </div>
          </div>
          <div class="list">
            <div class="lable">法人身份证号:</div>
            <div class="text" v-if="!basicModifyshow">{{ data.legalPersonId }}</div>
            <div v-if="basicModifyshow">
              <el-input v-model="fromBase.legalPersonId" placeholder="请输入"></el-input>
            </div>
          </div>
          <div class="list">
            <div class="lable">法人证件类型:</div>
            <div class="text">身份证</div>
          </div>
          <div class="list">
            <div class="lable">法人身份证开始日期:</div>
            <div class="text" v-if="!basicModifyshow">
              {{ data.legalPersonIdSdate }}
            </div>
            <div v-if="basicModifyshow">
              <!-- <el-input
                v-model="fromBase.legalPersonIdSdate"
                placeholder="请输入"
              ></el-input> -->
              <el-date-picker v-model="fromBase.legalPersonIdSdate" type="date" format="yyyy.MM.dd"
                value-format="yyyy.MM.dd" placeholder="选择日期" :clearable="false">
              </el-date-picker>
            </div>
          </div>
          <div class="list">
            <div class="lable">法人身份证结束日期:</div>
            <div class="text" v-if="!data.idCardValidType && !basicModifyshow">
              {{ data.legalPersonIdEdate }}
            </div>
            <div class="text" v-if="data.idCardValidType && !basicModifyshow">
              长期有效
            </div>
            <div v-if="basicModifyshow">
              <!-- <el-input
                v-model="fromBase.legalPersonIdEdate"
                placeholder="请输入"
              ></el-input> -->
              <el-date-picker v-model="fromBase.legalPersonIdEdate" type="date" format="yyyy.MM.dd"
                value-format="yyyy.MM.dd" placeholder="选择日期" :clearable="false">
              </el-date-picker>
            </div>
          </div>
          <div class="list">
            <div class="lable">法人联系电话:</div>
            <div class="text" v-if="!basicModifyshow">
              {{ data.phone }}
            </div>
            <div v-if="basicModifyshow">
              <el-input v-model="fromBase.phone" placeholder="请输入"></el-input>
            </div>
          </div>
          <div class="list">
            <div class="lable">注册地址:</div>
            <div class="text" v-if="!basicModifyshow">
              {{ data.registeredAddress }}
            </div>
            <div v-if="basicModifyshow">
              <el-input v-model="fromBase.registeredAddress" placeholder="请输入"></el-input>
            </div>
          </div>
          <div class="list">
            <div class="lable">店铺类型:</div>
            <div class="text" v-if="!basicModifyshow">
              {{ data.shopTypeParentName }} 》{{ data.shopTypeName }}
            </div>
            <el-cascader v-model="avalue" :options="typeLs" :show-all-levels="true" @change="handleChange"
              v-if="basicModifyshow"></el-cascader>
          </div>
          <div class="list">
            <div class="lable">店铺名称:</div>
            <div class="text" v-if="!basicModifyshow">{{ data.shopName }}</div>
            <div v-if="basicModifyshow">
              <el-input v-model="fromBase.shopName" placeholder="请输入"></el-input>
            </div>
          </div>
          <div class="list">
            <div class="lable">是否完成电子签章:</div>
            <div class="text">否</div>
          </div>
        </div>
        <!-- 日常消费结算账户资料 -->
        <div class="bt_box">
          <p class="btText">日常消费结算账户资料</p>
        </div>
        <div class="information">
          <div class="list">
            <div class="lable">结算方式:</div>
            <div class="text" v-if="!settlementShow">
              {{ settleInfo.settleBankTypeDict }}
            </div>
            <div class="txt" v-if="settlementShow">
              <el-select v-model="fromSettle.settleBankType" placeholder="请选择">
                <el-option v-for="item in options2" :key="item.id" :label="item.value" :value="item.id">
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="list">
            <div class="lable">结算费率:</div>
            <div class="text" v-if="!settlementShow">{{ settleInfo.fee }}</div>
            <div v-if="settlementShow">
              <el-input v-model="fromSettle.fee" placeholder="请输入"></el-input>
            </div>
          </div>
          <div class="list">
            <div class="lable">结算银行卡号:</div>
            <div class="text" v-if="!settlementShow">
              {{ settleInfo.balanceAccCardno }}
            </div>
            <div v-if="settlementShow">
              <el-input v-model="fromSettle.balanceAccCardno" placeholder="请输入"></el-input>
            </div>
          </div>
          <div class="list">
            <div class="lable">开户行名称:</div>
            <div class="text" v-if="!settlementShow">{{ settleInfo.bankName }}</div>
            <div class="txt" v-if="settlementShow">
              <el-select v-model="fromSettle.bankType" placeholder="请选择" @change="changes">
                <el-option v-for="item in bankOptionone" :key="item.id" :label="item.label" :value="item.id">
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="list">
            <div class="lable">所属支行名称:</div>
            <div class="text" v-if="!settlementShow">
              {{ settleInfo.openAccBankname }}
            </div>
            <div class="txt" v-if="settlementShow">
              <el-select v-model="fromSettle.openAccBanktype" placeholder="请选择" @change="changesTwo">
                <el-option v-for="item in bankOptiontwo" :key="item.id" :label="item.label" :value="item.id">
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="list">
            <div class="lable">银行预留手机号:</div>
            <div class="text" v-if="!settlementShow">
              {{ settleInfo.bankMobile }}
            </div>
            <div v-if="settlementShow">
              <el-input v-model="fromSettle.bankMobile" placeholder="请输入"></el-input>
            </div>
          </div>
          <div class="list">
            <div class="lable">结算类型:</div>
            <div class="text" v-if="!settlementShow">
              {{ settleInfo.clearingTypeDict }}
            </div>
            <div class="txt" v-if="settlementShow">
              <el-select v-model="fromSettle.clearingType" placeholder="请选择">
                <el-option v-for="item in options3" :key="item.id" :label="item.value" :value="item.id">
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="list">
            <div class="lable">结算账户名称:</div>
            <div class="text" v-if="!settlementShow">
              {{ settleInfo.balanceAccName }}
            </div>
            <div v-if="settlementShow">
              <el-input v-model="fromSettle.balanceAccName" placeholder="请输入"></el-input>
            </div>
          </div>
        </div>
        <!-- 存管结算账户资料 -->
        <depository-detail :id="id" :status="entryStatusInfo.depositEntryStatusDict"
          />
        <!-- 资质图片 -->
        <div class="bt_box">
          <p class="btText">资质图片</p>
        </div>
        <div class="imgBox" v-loading="allLoading" element-loading-text="上传中">
          <div class="imgList" v-if="ysimgInfo.businessLicence">
            <div class="lable">
              营业执照:
              <p class="watch_img" @click="handleFang(httpImg + ysimgInfo.businessLicence)">
                查看图片
              </p>
            </div>
            <div  class="avatar-uploader">
              <img v-if="ysimgInfo.businessLicence" :src="httpImg + ysimgInfo.businessLicence" class="img" />
            </div>
          </div>
          <div class="imgList" v-if="ysimgInfo.licence">
            <div class="lable">
              开户许可证:
              <p class="watch_img" @click="handleFang(httpImg + ysimgInfo.licence)">
                查看图片
              </p>
            </div>
            <div  class="avatar-uploader">
              <img v-if="ysimgInfo.licence" :src="httpImg + ysimgInfo.licence" class="img" />
            </div>
          </div>
          <div class="imgList" v-if="ysimgInfo.legalPersonFront">
            <div class="lable">
              法人身份证正面:
              <p class="watch_img" @click="handleFang(httpImg + ysimgInfo.legalPersonFront)">
                查看图片
              </p>
            </div>
            <div  class="avatar-uploader">
              <img v-if="ysimgInfo.legalPersonFront" :src="httpImg + ysimgInfo.legalPersonFront" class="img" />
            </div>
          </div>
          <div class="imgList" v-if="ysimgInfo.legalPersonBack">
            <div class="lable">
              法人身份证反面:
              <p class="watch_img" @click="handleFang(httpImg + ysimgInfo.legalPersonBack)">
                查看图片
              </p>
            </div>
            <div  class="avatar-uploader">
              <img v-if="ysimgInfo.legalPersonBack" :src="httpImg + ysimgInfo.legalPersonBack" class="img" />
            </div>
          </div>
          <div class="imgList" v-if="ysimgInfo.shopTop">
            <div class="lable">
              门头照:
              <p class="watch_img" @click="handleFang(httpImg + ysimgInfo.shopTop)">
                查看图片
              </p>
            </div>
            <div  class="avatar-uploader">
              <img v-if="ysimgInfo.shopTop" :src="httpImg + ysimgInfo.shopTop" class="img" />
            </div>
          </div>
          <div class="imgList" v-if="ysimgInfo.shopInterior">
            <div class="lable">
              室内场景照:
              <p class="watch_img" @click="handleFang(httpImg + ysimgInfo.shopInterior)">
                查看图片
              </p>
            </div>
            <div  class="avatar-uploader">
              <img v-if="ysimgInfo.shopInterior" :src="httpImg + ysimgInfo.shopInterior" class="img" />
            </div>
          </div>
          <div class="imgList">
            <div class="lable" v-if="ysimgInfo.shopCashierDesk">
              收银台照:
              <p class="watch_img" @click="handleFang(httpImg + ysimgInfo.shopCashierDesk)">
                查看图片
              </p>
            </div>
            <div  class="avatar-uploader">
              <img v-if="ysimgInfo.shopCashierDesk" :src="httpImg + ysimgInfo.shopCashierDesk" class="img" />
            </div>
          </div>
          <div class="imgList" v-if="ysimgInfo.bankCardFront">
            <div class="lable">
              结算银行卡正面:
              <p class="watch_img" @click="handleFang(httpImg + ysimgInfo.bankCardFront)">
                查看图片
              </p>
            </div>
            <div  class="avatar-uploader">
              <img v-if="ysimgInfo.bankCardFront" :src="httpImg + ysimgInfo.bankCardFront" class="img" />
            </div>
            
          </div>
          <div class="imgList" v-if="ysimgInfo.bankCardBack">
            <div class="lable">
              结算银行卡反面:
              <p class="watch_img" @click="handleFang(httpImg + ysimgInfo.bankCardBack)">
                查看图片
              </p>
            </div>
            <div  class="avatar-uploader">
              <img v-if="ysimgInfo.bankCardBack" :src="httpImg + ysimgInfo.bankCardBack" class="img" />
            </div>
          </div>
          <div class="imgList" v-if="ysimgInfo.unLegalPersonFront">
            <div class="lable">
              非法人身份证正面:
              <p class="watch_img" @click="handleFang(httpImg + ysimgInfo.unLegalPersonFront)">
                查看图片
              </p>
            </div>
            <div  class="avatar-uploader">
              <img v-if="ysimgInfo.unLegalPersonFront" :src="httpImg + ysimgInfo.unLegalPersonFront" class="img" />
            </div>
          </div>
          <div class="imgList" v-if="ysimgInfo.unLegalPersonBack">
            <div class="lable">
              非法人身份证反面:
              <p class="watch_img" @click="handleFang(httpImg + ysimgInfo.unLegalPersonBack)">
                查看图片
              </p>
            </div>
            <div  class="avatar-uploader">
              <img v-if="ysimgInfo.unLegalPersonBack" :src="httpImg + ysimgInfo.unLegalPersonBack" class="img" />
            </div>
          </div>
          <!-- <div class="imgList" v-if="ysimgInfo.handIdCard">
            <div class="lable">法人持授权书正面照:</div>
            <img
              class="img"
              :src="httpImg + ysimgInfo.handIdCard"
              alt=""
            />
          </div> -->
          <div class="imgList" v-if="ysimgInfo.handIdCard">
            <div class="lable">
              法人手持身份证合照:
              <p class="watch_img" @click="handleFang(httpImg + ysimgInfo.handIdCard)">
                查看图片
              </p>
            </div>
            <div  class="avatar-uploader">
              <img v-if="ysimgInfo.handIdCard" :src="httpImg + ysimgInfo.handIdCard" class="img" />
            </div>
          </div>
          <div class="imgList" v-if="ysimgurl">
            <div class="lable">面签二联单合同:</div>
            <div class="imgbox">
              <!-- <div class="closeimg el-icon-circle-close" @click="detailImg"></div> -->
              <img class="img" :src="httpImg + ysimgurl" alt="" @click="handleFang(httpImg + ysimgurl)" />
            </div>
          </div>
          <div class="imgList" v-if="!ysimgurl">
            <div class="lable">面签二联单合同:</div>
            <el-upload class="avatar-uploader2" :action="action" :show-file-list="false" :on-success="avatarSuccess"
              :before-upload="beforeAvatarUpload" :multiple="true" :limit="1" :on-exceed="onExceed"
              :on-progress="handlePreview">
              <i class="el-icon-plus" style="font-size: 28px"></i>
            </el-upload>
          </div>
          <div class="imgList" v-if="ysimgInfo.handIdCard">
            <div class="lable">
              非法人收款人身份证正面:
              <p class="watch_img" @click="handleFang(httpImg + ysimgInfo.handIdCard)">
                查看图片
              </p>
            </div>
            <div  class="avatar-uploader">
              <img v-if="ysimgInfo.handIdCard" :src="httpImg + ysimgInfo.handIdCard" class="img" />
            </div>
            
          </div>
          <div class="imgList" v-if="ysimgInfo.handIdCard">
            <div class="lable">
              非法人收款人身份证反面:
              <p class="watch_img" @click="handleFang(httpImg + ysimgInfo.handIdCard)">
                查看图片
              </p>
            </div>
            <div  class="avatar-uploader">
              <img v-if="ysimgInfo.handIdCard" :src="httpImg + ysimgInfo.handIdCard" class="img" />
            </div>
          </div>
        </div>
        
      </div>
    </ex-dialog>
    <img-detail-dialog v-if="ImgDetailDialog" :id="id" :imgUrl="urlData" :visible.sync="ImgDetailDialog" />
  </div>
</template>
<script>
// components
import Loading from "@/components/Loading/index";
import depositoryDetail from "./depositoryDetail";
import imgDetailDialog from "./imgDetailDialog";


// api
import {
    getqueryStatus,
    ysBase,
    settle,
    ysImg,
    adminDict,
    shopTypeTree,
    updateBase,
    yscontractImg,
    getBank,
    updateSettle,
    yscontract,
    ysPush,
    ysRefuse,
    updateOtherimg,
    entryStatus,
    entrySettle,
} from "@/api/merchants";

export default {
  components: {
    Loading,
    depositoryDetail,
    imgDetailDialog,
  },
  props: {
    visible: Boolean,
    id: String,
  },
  data() {
    return {
     depositFromId: "", //存管id
        allLoading: false,
        buttomLoading: false,
        buttomLoading2: false,
        action: process.env.VUE_APP_BASE_API + "/common/v1/uploadFile", 
        detailDialog: false,
        fundId: "",
        data: {},
        ImgDetailDialog: false,
        settleInfo: {},
        ysimgInfo: {},
        credentials: {},
        httpImg: '',
        options: [],
        options2: [],
        options3: [],
        value: "",
        input: "",
        basicModifyshow: false,
        settlementShow: false,
        entryStatus: "",
        merchantId: "",
        typeLs: [],
        avalue: [],
        entryStatusInfo: {}, //子商户进件状态
        ysimgurl: "", //二联单合同图片路径
        fromBase: {
          id: "",
          merchantId: "", //商家id
          businessLicence: "", //企业名称
          businessLicenceNo: "", //统一社会信用代码
          businessLicenceSdate: "", //营业执照开始日期
          businessLicenceEdate: "", //营业执照结束日期
          legalPersonName: "", //法人姓名
          legalPersonId: "", //法人身份证号
          legalPersonIdSdate: "", //法人身到期日期
          legalPersonIdEdate: "", //法人身份证开始日期
          phone: "", //法人联系电话
          registeredAddress: "", //注册地址
          merchantType: "", //商户类型
          shopTypeParent: "", //店铺类型父类型
          shopType: "", //店铺类型
          shopName: "", //店铺名称
        },
        fromSettle: {
          id: "",
          merchantId: "", //商家id
          settleBankType: "", //结算方式
          clearingType: "", //结算类型
          fee: "", //费率
          balanceAccCardno: "", //结算银行卡号
          bankName: "", //开户行名称
          bankType: "", //开户行code
          openAccBanktype: "", //所属支行code
          openAccBankname: "", //所属支行名称
          bankMobile: "", //银行预留电话
          balanceAccName:"",//结算账户名称
        },
        qxDate: "",
        radio: 2, //经营期限选择
        pickDisabled: true, //是否禁用经营期限时间选择
        bankOptionone: [], //银行
        bankOptiontwo: [], //支行
        formOtherimg: {
          id: "",
          businessLicence: "", //营业执照
          licence: "", //开户许可证
          legalPersonFront: "", //法人身份证正面
          legalPersonBack: "", //法人身份证背面
          shopTop: "", //商户门头照
          shopInterior: "", //内景照片
          bankCardFront: "", //结算账户正面
          bankCardBack: "", //结算账户背面
          shopCashierDesk: "", //收银台照片
          handIdCard: "", //手持身份证照片
          unLegalPersonFront: "", //非法人身份证正面
          unLegalPersonBack: "", //非法人身份证反面
        },
        pathType: '',
      };
  },
  computed: {},
  created() {
      // this.fundId = this.$route.query.fundId;
      this.merchantId = this.$route.query.merchantId;
      this.entryStatus = this.$route.query.entryStatus;
      this.pathType = this.$route.query.pathType;
      this.getclearingType();
      this.getlinkagelist();
      this.getTypels();
      this.getbankType();
      this.getentryStatus();
      this.getDetail();
      this.getentrySettle();
      // this.getsettleInfo();
      this.getysImg();
  },
  methods: {
    getlinkagelist() {
        //获取商户类型字典
        const params = {
          dictType: "merchant_type",
        };
        adminDict(params).then((res) => {
          this.options = res.result[0].dictList;
        });
      },
      getclearingType() {
        //获取结算类型字典
        const params = {
          dictType: "merchant_clearing_type",
        };
        adminDict(params).then((res) => {
          this.options3 = res.result[0].dictList;
        });
      },
      getentryStatus() {
        //查询商家进件状态
        const merchantId = this.id;
        entryStatus(merchantId)
          .then((res) => {
            this.entryStatusInfo = res.result;
          })
          .finally(() => {
            this.loading = false;
          });
      },
      getentrySettle() {
        //查询银盛进件商户日常结算账户信息
        const merchantId = this.id;
        entrySettle(merchantId)
          .then((res) => {
            // this.entryStatusInfo = res.result;
            this.settleInfo = res.result;
            this.fromSettle.id = res.result.id;
            this.fromSettle.merchantId = this.merchantId;
            this.fromSettle.settleBankType = res.result.settleBankType;
            this.fromSettle.clearingType = res.result.clearingType;
            this.fromSettle.fee = res.result.fee;
            this.fromSettle.balanceAccCardno = res.result.balanceAccCardno;
            this.fromSettle.bankMobile = res.result.bankMobile;
            this.fromSettle.openAccBanktype = res.result.openAccBanktype;
            this.fromSettle.bankType = res.result.bankType;
            this.fromSettle.bankName = res.result.bankName;
            this.fromSettle.openAccBankname = res.result.openAccBankname;
            this.fromSettle.balanceAccName = res.result.balanceAccName
            this.getBank();
          })
          .finally(() => {
            this.loading = false;
          });
      },
      // 获取店铺类型
      getTypels() {
        //shopTypeTree
        this.loading = true;
        shopTypeTree()
          .then((res) => {
            let ls = [];
            console.log("res.result+++", res.result);
            ls = this.getTreeData(res.result);
            // console.log(this.typeLs)
            let ls1 = ls.map((item) => {
              item.value = item.id;
              item.children.map((items) => {
                items.value = items.id;
              });
              return item;
            });
            console.log("ls1+++", ls1);
            this.typeLs = ls1;
          })
          .finally(() => {
            this.loading = false;
          });
      },
      handleChange(value) {
        let _this = this;
        console.log("value+++++++++++++", value);
        _this.fromBase.shopTypeParent = value[0];
        _this.fromBase.shopType = value[1];
      },
      getTreeData(data) {
        // 循环遍历json数据
        for (var i = 0; i < data.length; i++) {
          if (data[i].children.length < 1) {
            // children若为空数组，则将children设为undefined
            // data[i].children=undefined;
            delete data[i].children;
          } else {
            // children若不为空数组，则继续 递归调用 本方法
            this.getTreeData(data[i].children);
          }
        }
        return data;
      },
      changeRadio(e) {
        //经营期限选择
        console.log(e);
        if (e == 2) {
          this.pickDisabled = true;
          this.fromBase.businessLicenceEdate = "长期";
        } else {
          this.pickDisabled = false;
          this.fromBase.businessLicenceEdate = this.qxDate;
        }
      },
      changeDate(e) {
        //经营期限日期选择
        console.log(e);
        this.fromBase.businessLicenceEdate = e;
      },
      //获取进件商户基础信息
      getDetail() {
        const merchantId = this.id;
        ysBase(merchantId)
          .then((res) => {
            this.data = res.result;
            if (res.result.businessLicenceEdate == "长期") {
              this.fromBase.businessLicenceEdate = "长期";
              this.radio = 2;
              this.pickDisabled = true;
            } else {
              this.qxDate = res.result.businessLicenceEdate;
              this.pickDisabled = false;
              this.radio = 1;
              this.fromBase.businessLicenceEdate = this.qxDate;
            }
            this.fromBase.id = res.result.id;
            this.fromBase.merchantId = this.merchantId;
            this.fromBase.merchantType = res.result.merchantType;
            this.fromBase.businessLicence = res.result.businessLicence;
            this.fromBase.businessLicenceNo = res.result.businessLicenceNo;
            this.fromBase.businessLicenceSdate = res.result.businessLicenceSdate;
            // this.fromBase.businessLicenceEdate = res.result.businessLicenceEdate;
            this.fromBase.legalPersonName = res.result.legalPersonName;
            this.fromBase.legalPersonId = res.result.legalPersonId;
            this.fromBase.legalPersonIdSdate = res.result.legalPersonIdSdate;
            this.fromBase.legalPersonIdEdate = res.result.legalPersonIdEdate;
            this.fromBase.phone = res.result.phone;
            this.fromBase.shopName = res.result.shopName;
            this.fromBase.registeredAddress = res.result.registeredAddress;
            //处理店铺回显
            let value = [];
            value.push(res.result.shopTypeParent);
            value.push(res.result.shopType);
            value.join(",");
            this.avalue = value;
            this.fromBase.shopTypeParent = value[0];
            this.fromBase.shopType = value[1];
          })
          .finally(() => {
            this.loading = false;
          });
      },
      getsettleInfo() {
        //获取商户结算账户信息
        const merchantId = this.id;
        settle(merchantId)
          .then((res) => {
            this.settleInfo = res.result;
            this.fromSettle.id = res.result.id;
            this.fromSettle.merchantId = this.merchantId;
            this.fromSettle.settleBankType = res.result.settleBankType;
            this.fromSettle.clearingType = res.result.clearingType;
            this.fromSettle.fee = res.result.fee;
            this.fromSettle.balanceAccCardno = res.result.balanceAccCardno;
            this.fromSettle.bankMobile = res.result.bankMobile;
            this.fromSettle.openAccBanktype = res.result.openAccBanktype;
            this.fromSettle.bankType = res.result.bankType;
            this.fromSettle.bankName = res.result.bankName;
            this.fromSettle.openAccBankname = res.result.openAccBankname;
            this.getBank();
          })
          .finally(() => {
            this.loading = false;
          });
      },
      getbankType() {
        //获取结算方式字典
        const params = {
          dictType: "manage_settle_bank_type",
        };
        adminDict(params).then((res) => {
          this.options2 = res.result[0].dictList;
        });
      },
      getBank() {
        //获取银行信息
        const params = {};
        getBank(params).then((res) => {
          console.log(res.result);
          this.bankOptionone = res.result;
          if (this.fromSettle.bankType != "") {
            this.bankOptionone.map((item, index) => {
              if (this.fromSettle.bankType == item.id) {
                console.log(1111);
                this.bankOptiontwo = item.children;
              }
            });
          }
          // console.log(this.bankOptiontwo);
          this.fromBase.id = res.result.id;
          this.fromBase.merchantId = this.merchantId;
          this.fromBase.merchantType = res.result.merchantType;
          this.fromBase.businessLicence = res.result.businessLicence;
          this.fromBase.businessLicenceNo = res.result.businessLicenceNo;
          this.fromBase.businessLicenceSdate = res.result.businessLicenceSdate;
          // this.fromBase.businessLicenceEdate = res.result.businessLicenceEdate;
          this.fromBase.legalPersonName = res.result.legalPersonName;
          this.fromBase.legalPersonId = res.result.legalPersonId;
          this.fromBase.legalPersonIdSdate = res.result.legalPersonIdSdate;
          this.fromBase.legalPersonIdEdate = res.result.legalPersonIdEdate;
          this.fromBase.phone = res.result.phone;
          this.fromBase.shopName = res.result.shopName;
          this.fromBase.registeredAddress = res.result.registeredAddress;
          //处理店铺回显
          let value = [];
          value.push(res.result.shopTypeParent);
          value.push(res.result.shopType);
          value.join(",");
          this.avalue = value;
          console.log('店铺类型',this.avalue)
          this.fromBase.shopTypeParent = value[0];
          this.fromBase.shopType = value[1];
        })
        .finally(() => {
          this.loading = false;
        });
      },
      changes(value) {
        //银行
        console.log(value);
        this.bankOptionone.map((item, index) => {
          if (value == item.id) {
            this.bankOptiontwo = item.children;
            this.fromSettle.bankType = item.id;
            this.fromSettle.bankName = item.label;
          }
        });
        this.fromSettle.openAccBanktype = "";
        console.log(this.fromSettle);
      },
      changesTwo(id) {
        //支行选择
        this.bankOptiontwo.map((item, index) => {
          if (id == item.id) {
            this.fromSettle.openAccBanktype = item.id;
            this.fromSettle.openAccBankname = item.label;
          }
        });
      },
      handlePreview(e) {
        console.log(e);
        this.allLoading = true;
        setTimeout(() => {
          this.allLoading = false;
        }, 10000);
      },
      getysImg() {
        //获取资质图片
        const merchantId = this.id;
        ysImg(merchantId)
          .then((res) => {
            this.ysimgInfo = res.result;
            this.ysimgurl = res.result.contract;
          })
          .finally(() => {
            this.loading = false;
          });
      },
      handleAvatarSuccess(e, res, file) {
        this.allLoading = true;
        //上传资质图片
        //   this.formInline.shopIcon = res.result.url;
        console.log(e);
        console.log(res.result);
        this.formOtherimg.id = this.ysimgInfo.id;
        if (e == 1) {
          this.formOtherimg.businessLicence = res.result.url;
        } else if (e == 2) {
          this.formOtherimg.licence = res.result.url;
        } else if (e == 3) {
          this.formOtherimg.legalPersonFront = res.result.url;
        } else if (e == 4) {
          this.formOtherimg.legalPersonBack = res.result.url;
        } else if (e == 5) {
          this.formOtherimg.shopTop = res.result.url;
        } else if (e == 6) {
          this.formOtherimg.shopInterior = res.result.url;
        } else if (e == 7) {
          this.formOtherimg.shopCashierDesk = res.result.url;
        } else if (e == 8) {
          this.formOtherimg.bankCardFront = res.result.url;
        } else if (e == 9) {
          this.formOtherimg.bankCardBack = res.result.url;
        } else if (e == 10) {
          this.formOtherimg.unLegalPersonFront = res.result.url;
        } else if (e == 11) {
          this.formOtherimg.unLegalPersonBack = res.result.url;
        } else if (e == 12) {
          this.formOtherimg.handIdCard = res.result.url;
        }
        console.log(this.formOtherimg);
        var params = {
          ...this.formOtherimg,
        };
        updateOtherimg(params)
          .then((res) => {
            this.$message({
              message: "上传成功",
              type: "success",
              duration: 1500,
            });
            setTimeout(() => {
              this.getysImg();
              this.allLoading = false;
            }, 800);
          })
          .finally(() => {
            this.allLoading = false;
          });
      },
      //放大图片
      handleFang(url) {
        this.urlData = url;
        this.ImgDetailDialog = true;
      },
      fileArr(data) {
        if (data) {
          if (data.length > 1) {
            return data.join(",");
          } else if (data.length <= 1) {
            return data[0];
          }
        }
      },
      avatarSuccess(res, file, fileList) {
        //面签二联单合同图片上传
        //   this.formInline.shopImgs.push(res.result.url);
        this.ysimgurl = res.result.url;
        if (this.ysimgurl != "") {
          var params = {
            id: this.ysimgInfo.id,
            url: this.ysimgurl,
          };
          yscontractImg(params).then((res) => {
            this.$message({
              message: "上传成功",
              type: "success",
              duration: 1500,
            });
            setTimeout(() => {
              this.getysImg();
            }, 800);
          });
        }
      },
      onExceed(files, fileList) {
        this.$message.error("最多上传1张图片");
      },
      detailImg(index) {
        console.log(index);
        this.ysimgurl = "";
        //   this.formInline.shopImgs.splice(index, 1);
      },
      beforeAvatarUpload(file) {
        console.log(file);
        const format = ["image/jpeg", "image/jpg", "image/png"];
        const isJPG = format.some((item) => file.type === item);
        const isLt2M = file.size / 1024 / 1024 < 2;
        if (!isJPG) {
          this.$message.error("上传头像图片只能是 jpeg,jpg,png格式!");
        }
        //   if (!isLt2M) {
        //     this.$message.error("上传头像图片大小不能超过 2MB!");
        //   }
        // return isJPG && isLt2M;
        return isJPG;
      },
      //修改结算方式
      editSettlement() {
        const merchantNo = this.data.merchantNo;
        getapplyqueryStatus(merchantNo)
          .then((res) => {
            const {
              status
            } = res.result;
            if (status != 2 && status != 7) {
              this.$router.push({
                path: "/moneyManagement/edit-eettlement",
                query: {
                  merchantNo: this.data.merchantNo,
                  showName: this.data.showName,
                },
              });
            } else {
              this.$message({
                message: "在审核中不能修改",
                type: "warning",
                duration: 1500,
              });
            }
          })
          .finally(() => {
            this.loading = false;
          });
      },

      //修改费率
      editRate() {
        const merchantNo = this.data.merchantNo;
        getqueryStatus(merchantNo).then((res) => {
          const {
            status
          } = res.result;
          if (status != 1) {
            this.$router.push({
              path: "/moneyManagement/edit-rate",
              query: {
                merchantNo: this.data.merchantNo,
              },
            });
          } else {
            this.$message({
              message: "在审核中不能修改",
              type: "warning",
              duration: 1500,
            });
          }
        });
      },
      //查看
      lookDetail() {
        this.detailDialog = true;
      },
      //资本资料修改
      basicModify() {
        this.basicModifyshow = true;
      },
      //资本资料保存
      basicSumit() {
        var params = {
          ...this.fromBase,
        };
        updateBase(params).then((res) => {
          this.$message({
            message: "修改成功",
            type: "success",
            duration: 1500,
          });
          this.getDetail();
          setTimeout(() => {
            this.basicModifyshow = false;
          }, 800);
        });
      },
      //日常消费结算账户结算账户资料修改
      settlementMide() {
        this.settlementShow = true;
      },
      //日常消费结算账户结算账户资料保存
      settlementSumit() {
        var params = {
          ...this.fromSettle,
        };
        updateSettle(params).then((res) => {
          this.$message({
            message: "修改成功",
            type: "success",
            duration: 1500,
          });
          // this.getsettleInfo();
          this.getentrySettle();
          setTimeout(() => {
            this.settlementShow = false;
          }, 800);
        });
      },
      contractIssuance() {
        //下发电子合同
        const merchantId = this.id;
        yscontract(merchantId).then((res) => {
          this.$message({
            message: "发送成功",
            type: "success",
            duration: 1500,
          });
          // setTimeout(() => {

          // }, 800);
        });
      },
      getdepositFromId(id) {
        console.log("id+++++++++++", id);
        this.depositFromId = id;
      },
      setYspush(id, type) {
        if (type == 1) {
          this.buttomLoading = true;
        } else {
          this.buttomLoading2 = true;
        }
        //推送银盛审核
        ysPush(id)
          // this.buttomLoading = true
          .then((res) => {
            this.$message({
              message: "发送成功",
              type: "success",
              duration: 1500,
            });
            this.buttomLoading = false;
            this.buttomLoading2 = false;
          })
          .finally(() => {
            this.buttomLoading = false;
            this.buttomLoading2 = false;
          });
      },
      ysRefuse() {
        //拒绝商家入驻
        this.$prompt("请输入拒绝原因", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            inputPattern: /\S/,
            inputErrorMessage: "请输入拒绝原因",
          })
          .then(({
            value
          }) => {
            const params = {
              merchantId: this.id,
              remark: value,
            };
            ysRefuse(params).then((res) => {
              this.$message({
                message: "已拒绝",
                type: "success",
                duration: 1500,
              });
              setTimeout(() => {
                this.getDetail();
              }, 800);
            });
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "取消输入",
            });
          });
      },
      handleClose() {
        this.$emit("update:visible", false);
      },
  },
};
</script>
<style lang="scss" scoped>
  @import "../../../style/incomingDetail";
.ex-diolog {
  ::v-deep .ex--dialog--footer {
    border: none !important;
    padding: 0 !important;
  }
  ::v-deep .ex--dialog--main {
    padding: 10px 20px !important;
  }
}
.main {
  .text {
    line-height: 1.6;
  }
  .inp {
    margin-top: 12px;
  }
  .btn {
    margin-top: 12px;
    display: flex;
    justify-content: center;
  }
}
</style>
